home *** CD-ROM | disk | FTP | other *** search
/ Aminet 16 / Aminet 16 (1996)(GTI - Schatztruhe)[!][Dec 1996].iso / Aminet / dev / src / wangisrc.lha / wangi / z / NG_New / NaeGrey.c < prev    next >
C/C++ Source or Header  |  1995-07-30  |  2KB  |  83 lines

  1. #include "gst.c"
  2.  
  3. extern struct Library *IconBase = NULL;
  4. extern struct IntuitionBase *IntuitionBase = NULL;
  5. extern struct GfxBase *GfxBase = NULL;
  6.  
  7. #define GFX_BLANK_FLAG (1<<5)
  8.  
  9. #define BLANK_ON 0
  10. #define BLANK_OFF 1
  11. #define BLANK_TOGGLE 2
  12.  
  13. char vertag[] = "$VER: NaeGrey 2.0 "__AMIGADATE__;
  14.  
  15. void main(int argc, char **argv)
  16. {
  17.     if( (GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 0)) &&
  18.         (IntuitionBase = (struct IntutuionBase *)OpenLibrary("intuition.library", 0)) &&
  19.         (IconBase = OpenLibrary("icon.library", 0)) )
  20.     {
  21.         STRPTR actionstr = NULL;
  22.         struct RDArgs *rdargs = NULL;
  23.         struct DiskObject *dobj = NULL;
  24.         LONG action;
  25.         /* Get tooltypes */
  26.         if (argc ? FALSE : TRUE) {
  27.             BPTR oldcd;
  28.             struct WBStartup *wbs;
  29.             #define PROGNAME wbs->sm_ArgList->wa_Name
  30.             #define PDIRLOCK wbs->sm_ArgList->wa_Lock
  31.             wbs = (struct WBStartup *)argv;
  32.             /* Run from WB */
  33.             oldcd = CurrentDir(PDIRLOCK);
  34.             if (dobj = GetDiskObject(PROGNAME)) {
  35.                 actionstr = FindToolType(dobj->do_ToolTypes, "SPEED");
  36.             }
  37.             CurrentDir(oldcd);
  38.         } else {
  39.             #define OPT_ACTION 0
  40.             LONG args[1] = {0};
  41.             #define TEMPLATE "ACTION"
  42.             /* Run from Shell */
  43.             if (rdargs = ReadArgs(TEMPLATE, (LONG *)&args, NULL)) {
  44.                 if (args[OPT_ACTION]) {
  45.                     actionstr = (STRPTR)args[OPT_ACTION];
  46.                 }
  47.             }
  48.         }
  49.         action = BLANK_ON;
  50.         if( MatchToolValue(actionstr, "OFF") )
  51.             action = BLANK_OFF;
  52.         if( MatchToolValue(actionstr, "TOGGLE") )
  53.             action = BLANK_TOGGLE;
  54.  
  55.         if( dobj )
  56.             FreeDiskObject(dobj);
  57.         if( rdargs )
  58.             FreeArgs(rdargs);
  59.         
  60.         switch( action )
  61.         {
  62.             case BLANK_ON:
  63.                 GfxBase->BP3Bits |= GFX_BLANK_FLAG;
  64.                 break;
  65.             case BLANK_OFF:
  66.                 GfxBase->BP3Bits &= !(GFX_BLANK_FLAG);
  67.                 break;
  68.             case BLANK_TOGGLE:
  69.                 if( GfxBase->BP3Bits & GFX_BLANK_FLAG )
  70.                     GfxBase->BP3Bits &= !(GFX_BLANK_FLAG);
  71.                 else
  72.                     GfxBase->BP3Bits |= GFX_BLANK_FLAG;
  73.                 break;
  74.         }
  75.         
  76.         RemakeDisplay();
  77.         
  78.         CloseLibrary(IconBase);
  79.         CloseLibrary((struct Library *)IntuitionBase);
  80.         CloseLibrary((struct Library *)GfxBase);
  81.     }
  82. }
  83.